package com.csx.framework.springboot.sample.boot;

import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.support.AbstractApplicationContext;

/**
 *
 * @author cuisongxu
 * @date 2024/2/25 周日 13:51
 */
public class A1ApplicationContextInitializer implements ApplicationContextInitializer<AbstractApplicationContext> {


    /**
     * 生效时间: 在容器刷新前生效
     * 扩展方式:
     *      ① 代码添加:
     *          主启动类中的main方法处通过 SpringApplication.addInitializers(new A1ApplicationContextInitializer()) 语句
     *      ② 配置文件配置:
     *          context.initializer.classes = com.csx.framework.springboot.sample.boot.A1ApplicationContextInitializer
     *      ③ Spring SPI扩展:
     *          在META-INF/spring.factories中添加 org.springframework.context.ApplicationContextInitializer = com.csx.framework.springboot.sample.boot.A1ApplicationContextInitializer
     *
     * @param abstractApplicationContext the application to configure
     */
    @Override
    public void initialize(AbstractApplicationContext abstractApplicationContext) {
        System.out.println("顺序1 --- A1ApplicationContextInitializer 在容器刷新前调用, 可以拿到 AbstractApplicationContext 类型对象");
        System.out.println();
    }


}
